<head th:fragment="headerCss">
    <meta charset="utf-8">
    <title></title>
    <meta content="width=device-width, initial-scale=1.0" name="viewport">
    <meta name="keywords" content="全国职业院校技能大赛中等职业教育 -- 母婴照护赛项">
    <meta name="description" content="全国职业院校技能大赛中等职业教育 -- 母婴照护赛项">
    <link rel="stylesheet" href="/js/layui/css/layui.css">
    <!-- Bootstrap CSS File -->
    <!--<link href="/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">-->
    <link rel="stylesheet" href="/css/examination/common.css">
    <link href="/css/font-awesome.css?v=4.4.0"
          th:href="@{/css/font-awesome.css?v=4.4.0}" rel="stylesheet">
    <!-- Google Fonts -->
    <link rel="shortcut icon" href="">
    <link rel="stylesheet" href="/css/swiper-bundle.css">

    <style>
        .ti1{float: left;width: 20%;line-height: 42px;color: #333}
        .ti2{float: right !important;width: 75%;text-align: left !important;}
        #examinationList,.layui-input{border-color: #ccc;border-radius: 5px;color: #999 !important; font-size: 12px !important;}
        .windowstor{height: initial;}
        .tips{font-size: 25px;color: #E60214;display: none;width: 400px;margin: 30px auto 0;}

        .newtoptit{width: 100%;margin: 75px auto 37px; text-align: center;}
        .newtoptit img{width: 128px;height: 126px;display: block;margin: 0 auto;}
        .newaddtips{margin: 0;}
        .loginIn {width: 300px !important;}
        .ti1 {width: 23% !important;}
        .main_content{
            width: 100%;
            height: 100%;
            position: relative !important;
        }
        .window_box{
            width:360px;
            margin: 0 !important;
            border-radius: 12px 12px 12px 12px;
            position: absolute !important;
            right: 10%;
            top: 25%;
            /*background: url("../../../img/loginindexbg.png") no-repeat;*/
            background-size: 100% 100%;
        }
        .infantBox {
            position: absolute;
            height: 360px !important;
            background: #FFFFFF;
            box-shadow: 0px 3px 12px 1px rgba(86,0,5,0.16)
        }
        .infant {
            margin: 0 !important;
        }

        .leftForm {
            width: 500px;
            margin-top: 46px;
            margin-left: 25px;
        }
        .layui-btn {
            padding: 30px 20px;
            /*background: url("../../../img/loginBtn.png") no-repeat !important;*/
            background-size: 100% 100% !important;
            border: 0;
            color: #FFFFFF !important;
        }
        #examinationList, .layui-input {
            /*border-color:#8bd8da;*/
            /*border-radius: 28px;*/
            font-size: 14px !important;
        }
        .btn-login:hover,.btn-login:focus,.btn:active:focus, .btn:focus{
            border: none;
            outline: none;
        }
        .btn:active{
            box-shadow: none;
        }
        .btn {
            width: 100%;
        }
        .titles{
            font-size: 24px;
            color: #000000;
            margin-bottom: 32px;
            padding-bottom: 8px;
            position: relative;
            text-align: center
        }
        /*.titles:after{*/
        /*    content: '';*/
        /*    position: absolute;*/
        /*    width: 38px;*/
        /*    height: 4px;*/
        /*    background: #2C82EB;*/
        /*    left: 50%;*/
        /*    margin-left: -19px;*/
        /*    bottom: 0;*/
        /*}*/
        .infantBox .leftForm {
            width: 431px;
        }
        .layui-input {
            height: 45px;
        }
        .btn-block {
            height: 50px;
        }
        #loginLogoImage {
            position: absolute;
            top: 20%;
            left: 15%;
        }
        .btn-login{
            height: 48px;
            border-radius: 4px 4px 4px 4px;
            cursor: pointer;
        }
    </style>
</head>
<body id="examinationLoginImage" class="signin infantGin">

<div class="main_content infant">
    <img id="loginLogoImage" src="" style="width: 22%;height: auto;display: none;">
    <div class="window_box infantBox">

        <div class="leftForm">
            <div class="titles">选手登录</div>
            <div class="tips" id="tips">请升级你的浏览器，该浏览器不支持此考试系统，建议使用谷歌浏览器！(谷歌浏览器可进行正常考试)</div>

            <div class="loginIn">


                <div class="item" style="display: none">
                    <select id="examinationList" name="examinationList" class="ti4 layui-input">
                        <option value="" checked>请选择考试批次</option>
                    </select>
                    <div style="clear: both"></div>
                </div>
                <div class="item">
                    <input type="text" id="num2" placeholder="请输入第二次加密号" autocomplete="new-password"
                           class="ti4 layui-input">
                    <div style="clear: both"></div>
                </div>

                <div class="item">
                    <input  type="text" id="randomCipher" placeholder="请输入您的密码" autocomplete="new-password" class="ti4 layui-input">
                    <div style="clear: both"></div>
                </div>
                <div class="item">
                    <input type="hidden" th:value="${time}" id="times" />
                    <input type="hidden" th:value="${dates}" id="dates" />
                    <button id="loginBtnColor" class="btn btn-login btn-block" onclick="login()">登 录</button>
                </div>

            </div>
        </div>


    </div>

</div>

<script>

    function isIE() {
        if (!!window.ActiveXObject || "ActiveXObject" in window)
            return true;
        else
            return false;
    }

    if( isIE() ){
        document.getElementById('tips').style.display = 'block';
    }

</script>

<script src="/js/jquery.min.js?v=2.1.4" th:src="@{/js/jquery.min.js?v='2.1.4'}"></script>
<script src="/js/plugins/layer/layer.min.js" th:src="@{/js/plugins/layer/layer.min.js}"></script>
<script src="/js/swiper-bundle.js"></script>
<script type="text/javascript" src="/js/webJs/defaultConfig/style.config.js"></script>
<script type="text/javascript">

    $().ready(function() {
        cteated(101)
        cteated(203)
        cteated(302)
        cteated(205)
        cteated(402)
    });
    //回车登录
    var examinationListIntro = null, gather = [] ;
    document.onkeydown =cdk;
    function cdk(){
        if(event.keyCode ==13){
            login();
        }
    }

    var id=null;
    // $(function () {
    //
    //     $.ajax({
    //         url: "/jzApi/examinations/selExaminationCom",
    //         async : false,
    //         data:{type:3},
    //         success: function (r) {
    //             //console.log("r",r)
    //             if(r.code !=-1){
    //                 if(window.localStorage){
    //                     //window.localStorage.setItem("intro",JSON.stringify(r.data));
    //                     // window.localStorage.setItem("backGroundImage",r.data.backGroundImage);
    //                 }else{
    //                     layer.msg("请换浏览器，最佳为谷歌")
    //                 }
    //                 examinationListIntro = r.data;
    //                 for(var p in r.data){
    //                     $("#examinationList").append("<option value='"+r.data[p].id+"'>"+r.data[p].name+"</option>");
    //                 }
    //                 $("#title").html('1+X幼儿照护证书在线考试');
    //                 //id = r.data.id
    //             }else{
    //                 $("#title").html('暂无在线考试');
    //             }
    //         }
    //     });
    //
    // });

    /**
     * 登录
     * */
    function login() {
        $.ajax({
            url: "/jzApi/examinations/selExaminationComType",
            async : false,
            data:{type:3,competitionType:2},
            success: function (r) {
                //console.log("r",r)
                if(r.code !=-1){
                    if(window.localStorage){
                    }else{
                        layer.msg("请换浏览器，最佳为谷歌")
                    }
                    examinationListIntro = r.data;
                    for(var p in r.data){
                        $("#examinationList").append("<option value='"+r.data[p].id+"'>"+r.data[p].name+"</option>");
                    }
                    $('#examinationList').val(r.data[0].id)
                    logins()
                    //id = r.data.id
                }else{
                    layer.msg("暂无考试信息")
                }
            }
        });

    }


    function logins () {
        var examinationId = $("#examinationList").val().trim();
        var randomCipher = $("#randomCipher").val().trim();
        var num2 = $("#num2").val().trim()
        // if ('' == examinationId) {
        //     layer.msg('请选择考试批次');
        //     return false
        // }

        if ('' == num2) {
            layer.msg('请输入第二次加密');
            return false
        }
        if ('' == randomCipher) {
            layer.msg('请输入随机密码');
            return false
        }

        $.ajax({
            type: "POST",
            url:  "/jzApi/examinations/loginExamination",
            // data: {id:examinationId,name:username , idNumber:idNumber, ticketNumber:ticketNumber},
            data: {id:examinationId,randomCipher:randomCipher, num2:num2,competitionType:2},
            success: function (r) {
                if (r.code == 0) {
                    let userinfo = JSON.parse(window.localStorage.getItem("info"));
                    if( userinfo ){
                        if( r.data.ticketNumber == userinfo.ticketNumber ){
                            location.href = '/examination/startExam'
                        }else{
                            localStorage.clear();
                        }
                    }

                    if(window.localStorage){
                        for(var e in examinationListIntro){
                            if(examinationListIntro[e].id == examinationId){
                                // window.localStorage.setItem("intro"+r.data.idCard,JSON.stringify(examinationListIntro[e]));
                                window.localStorage.setItem("intro",JSON.stringify(examinationListIntro[e]));
                                break;
                            }
                        }
                        window.localStorage.setItem("batchName",r.data.batchName);
                        window.localStorage.setItem("info",JSON.stringify(r.data));
                        window.localStorage.setItem("nowDate",r.data.nowDate);
                        window.localStorage.setItem("cbatchId",r.data.cbatchId);
                        window.localStorage.setItem("times",JSON.stringify($('#times').val()));
                        window.localStorage.setItem("dates",JSON.stringify($('#dates').val()));
                    }else{
                        layer.msg("请换浏览器，最佳为谷歌")
                    }

                    location.href = '/examination/startExam'
                } else if(r.code === '-1'){
                    if(r.msg === '信息错误！') {
                        layer.msg('二次加密号或密码错误，请重新输入！');
                    }else {
                        layer.msg(r.msg);
                    }

                }else {
                    layer.msg(r.msg);
                }
            }
        });
    }
</script>
</body>





